import store from "store";
import { getUrlParam } from "cl-admin/utils";
const { NODE_ENV, VUE_APP_WEBSOCKET, VUE_APP_APIHOST, VUE_APP_WEBSITE, VUE_APP_ENV } = process.env;
export const appEnv = VUE_APP_ENV;
// 自动使用环境变量
export const autoEnv = false;
// autoEnv = false 自定义接口地址-php

const customApi = "https://api.qinmei.cchaosheng.com";
// const customApi = "http://api.yimei.local.com";

const customSocket = "wss://api.qinmei.cchaosheng.com/wss";

export const ossHost = "https://yimeizhimei.oss-cn-shanghai.aliyuncs.com"
export const cdnHost = "https://yimeizhimei.oss-cn-shanghai.aliyuncs.com"

const defConf = {
	host: VUE_APP_APIHOST || "https://api.qinmei.cchaosheng.com",
	socketUrl: VUE_APP_WEBSOCKET || "ws://129.211.64.240:2323",
	baseUrl() {
		let proxy = getUrlParam("proxy");
		if (proxy) {
			store.set("proxy", proxy);
		} else {
			proxy = store.get("proxy") || "dev";
		}
		// return isDev ? `${host}/group` : `/group`;
		return `${this.host}/group`;
	}
};
if (!autoEnv) {	
	defConf.host = customApi;
	defConf.socketUrl = customSocket;
}
export const website = VUE_APP_WEBSITE;
// console.log(process.env);
// 路由模式
export const routerMode = "history";

// 开发模式
export const isDev = NODE_ENV == "development";
export const isProd = NODE_ENV == "production";
// Host
export const host = defConf.host;
export const apiHost = defConf.host;

export const socketUrl = defConf.socketUrl;

// 请求地址
export const baseUrl = defConf.baseUrl();

// 阿里字体图标库 https://at.alicdn.com/t/**.css
export const iconfontUrl = ``;

// 程序配置参数
export const app = store.get("__app__") || {
	name: "CRM",
	conf: {
		showAMenu: false, // 是否显示一级菜单栏
		showRouteNav: false, // 是否显示路由导航栏
		showProcess: true, // 是否显示页面进程栏
		customMenu: false // 自定义菜单
	},
	theme: {
		color: "#156DFF", // 主题色
		url: "/theme/index.css" // 主题样式地址
	}
};

// 自定义菜单列表
export const menuList = [];
